package com.fz.us.admin.company.service;


import com.fz.us.admin.base.bean.search.order.Order;
import com.fz.us.admin.base.bean.search.page.PagePaging;
import com.fz.us.admin.base.bean.search.result.SearchResultPaging;
import com.fz.us.admin.base.bean.search.rule.Rule;

import com.fz.us.admin.base.service.BaseService;
import com.fz.us.admin.company.bean.FlowEnum;
import com.fz.us.admin.company.entity.BaseFlowEntity;
import com.fz.us.admin.company.entity.Company;
import com.fz.us.admin.company.entity.Duty;



import java.util.List;
import java.util.Map;


/**
 * Service接口 - 管理员
 * ============================================================================
 * 版权所有 2014 上海玖达信息职业技术有限公司，并保留所有权利。
 * ----------------------------------------------------------------------------
 *
 * 
 * @version 0.1 2014-11-18
 */

public interface BaseFlowService<T extends BaseFlowEntity, PK extends String> extends BaseService<T , PK> {

    /**
     * add by zhucx
     * 保存流程，创建任务实例
     */
    public PK save(T entity, String entityName);


    /**
     * add by zhucx
     * 未保存的情况下直接创建流程
     * @return
     */
    public PK commit(T entity, String entityName, Duty duty);

    /**
     * add by zhucx
     * 提交审批(一定保存过)
     * @return
     */
    public void approve(T entity, Duty duty, String comment);




    /**
     * add by zhucx
     * 退回操作
     * @param entity
     * @param duty
     * @param comment
     */
    public void back(T entity, Duty duty, String comment);



    /**
     * add by zhucx
     * 否决操作
     * @return
     */
    public void deny(T entity, Duty duty, String comment);



    /**
     * 分页
     *
     * @param page
     * @param order
     * @return
     */
    public SearchResultPaging paging(PagePaging page, List<Rule> rules, Order order, String entityName, FlowEnum.ProcessState[] processState, Map<String,Object> params);
    /**
     * 计算步骤条件公式
     * @param formulaField
     * @param formulaFlag
     * @param formulaVal
     * @param keyId
     * @param entityName
     * @return
     */
    public boolean calStepCon(String formulaField, String formulaFlag, String formulaVal, String keyId, String entityName);

}